using Cysharp.Threading.Tasks;

namespace FrameWork
{
    public interface IManager
    {
        UniTask OnInitStart();
        UniTask OnInit();
        UniTask OnInitEnd();
        void OnStart();
        void OnRelease();
        void OnUpdate();
    }
    
    public abstract class BaseManager : IManager
    {
        // 确保派生类在程序集内部实例化
        // ReSharper disable once ClassNeverInstantiated.Global
        protected internal sealed record ConstructorToken
        {
            private ConstructorToken() { }
        }
        
        //此处不可更改，存在的意义是为了保证派生类必须显示声明internal 或者private 的构造函数
        protected internal BaseManager(ConstructorToken constructorToken)
        {
           
        }
        
        public virtual UniTask OnInitStart() => UniTask.CompletedTask;
        public virtual UniTask OnInit() => UniTask.CompletedTask;
        public virtual UniTask OnInitEnd() => UniTask.CompletedTask;
        public virtual void OnStart() { }
        public virtual void OnRelease() { }
        public virtual void OnUpdate() { }
    }
}
